
//
// 120318 - AH - Created.
// 120320 - AH - Included 'Binary Data Storage' requests.
// 120325 - AH - (Garage *) Lot of conversation element stuff.
// 120329 - AH - Request to delete all data.
// 120401 - AH - Request to upload rat base and get all rat bases.
//

package org.soekrat.server.servlets;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * <p>
 *   Implements the request to show the developer's API page.
 * </p>
 * @author Arne Halvorsen (AH)
 * @author Laetitia Le Chatton (LLC)
 */
@SuppressWarnings("serial")
public final class PrintSoekratDevelopersPageHttpServlet
  extends AbstractSoekratHttpServlet 
{
  /**
   * <p>
   *   Constructor.
   * </p>
   */
  public PrintSoekratDevelopersPageHttpServlet(){}

  @Override
  protected void handleRequest(HttpServletRequest req, HttpServletResponse res)
    throws ServletException, IOException 
  {
    PrintWriter pw=printSimpleHtmlStart(res, "Soekrat Web API");
    
    pw.println("<p>");
    pw.println("Raw access to Soekrat Web API <br/>");
    pw.println("Response is in JSON, more format may be supported for future"+
      " demands (i.e. XML)<br/>");
    pw.println("Note: Changes done to live server!<br/>");
    pw.println("Note: Pretty primitive, but back button not broken, use to "+
      "get back to form from response page.");
    pw.println("</p>");
    
    pw.println("<h2>Alternative Requests</h2>");
    
    printHtmlLink(pw, "json_req", "Json");
    
    pw.println("<h2>Chat</h2>");
    
    printHtmlLink(pw, "soekrat", "Visitor Chat");
    
    pw.println("<h2>Accounts</h2>");
    
    printHtmlLink(pw, "create_account", "Create Account");
    printHtmlLink(pw, "get_named_account", "Get Named Account");
    printHtmlLink(pw, "rename_account", "Rename Account");
    printHtmlLink(pw, "get_accounts", "Get Accounts");
    printHtmlLink(pw, "delete_account", "Delete Account");
    
    pw.println("<h2>Conversation Elements</h2>");
    
    printHtmlLink(pw, "create_ce", "Creates Conversation Element For Given Account");
    printHtmlLink(pw, "get_ces", "Gets Conversation Elements For Given Account");
    printHtmlLink(pw, "get_all_ces", "Gets All Conversation Elements");
    printHtmlLink(pw, "delete_ce", "Delete Conversation Element");
    printHtmlLink(pw, "delete_ces", "Delete Conversation Elements");
    printHtmlLink(pw, "get_ce_keys", "Get All Conversation Element Keys");
    
    pw.println("<h2>Semantic Effects</h2>");
    
    printHtmlLink(pw, "create-semantic-effect", "Creates Semantic Effect For Given Conversation Element");
    printHtmlLink(pw, "get-semantic-effects", "Get Semantic Effects");
    printHtmlLink(pw, "delete-semantic-effect", "Delete Semantic Effect");
    printHtmlLink(pw, "get_available_semantic_effect_names", "Get Available Semantic Effect Names");
    
    pw.println("<h2>Folders And Files</h2>");
    
    printHtmlLink(pw, "create_folder", "Create folder");
    printHtmlLink(pw, "get_folder", "Get folder given its key");
    printHtmlLink(pw, "get_folder_content", "Get folder's content given its key");
    printHtmlLink(pw, "get_folders", "Get folders");
    
    printHtmlLink(pw, "file_upload", "Upload file");
    printHtmlLink(pw, "rat_base_upload", "Upload Rat Database");
    printHtmlLink(pw, "get_rat_bases", "Get All Rat Databases");
    printHtmlLink(pw, "lookup_file", "Lookup file");
    printHtmlLink(pw, "lookup_text_file", "Lookup text file");
    
    pw.print("<h2>Tools</h2>");
    printHtmlLink(pw, "clear_db", "Delete all data in database");
    //printHtmlLink(pw, "pit_insprection", "Pit Inspection");
    printHtmlLink(pw, "get_available_ontology_names", "Get Available Ontologies");
    
    printSimpleHtmlEnd(pw);
  }
  
}
